from django.db import models

# Create your models here.
class LoginModel(models.Model):
    phone=models.CharField(max_length=50,verbose_name="手机号")
    password=models.CharField(max_length=50,verbose_name="密码")
    class Meta:
        db_table="login"
    def __str__(self):
        return self.phone
class Get_BookModel(models.Model):
    BookCate=models.CharField(max_length=50,verbose_name="图书分类")
    author=models.CharField(max_length=50,verbose_name="作者")
    HouseModel=models.CharField(max_length=50,verbose_name="出版社")
    BookTime=models.DateField(auto_now_add=True,verbose_name="出版时间")
    price=models.DecimalField(max_digits=10,decimal_places=2,verbose_name="价格")
    BookshelfName=models.CharField(max_length=50,verbose_name="书架名称")
    num=models.IntegerField(verbose_name="库存数量")
    ElectronicData=models.BooleanField(default=True,verbose_name="是否电子资料")
    Bookclassification=models.CharField(max_length=50,verbose_name="图书密级")
    Isitloanedout=models.BooleanField(default=True,verbose_name="是否外借")
    class Meta:
        db_table="getbook"
    def __str__(self):
        return self.BookCate
# 待还书
class WaitBookModel(models.Model):
    img=models.ImageField(upload_to='upload/',default=False,null=True,blank=True,verbose_name="图片")
    author=models.CharField(max_length=50,verbose_name="作者")
    HouseModel=models.CharField(max_length=50,verbose_name="出版社")
    borrowbooksTime=models.DateField(auto_now_add=True,verbose_name="借书时间")
    returnbooksTime=models.DateField(auto_now_add=True,verbose_name="还书时间")

    class Meta:
        db_table="waitbook"
    def __str__(self):
        return self.author
class IwantLookModel(models.Model):
    name=models.CharField(max_length=50,verbose_name="书名")
    book_cate=models.ForeignKey(to="BookCateModel",on_delete=models.CASCADE,verbose_name="图书分类")
    author=models.CharField(max_length=50,verbose_name="作者")
    translator=models.CharField(max_length=50,verbose_name="译者")
    HouseModel=models.CharField(max_length=50,verbose_name="出版社")
    BookTime=models.DateField(auto_now_add=True,verbose_name="出版时间")
    price=models.DecimalField(max_digits=10,decimal_places=2,verbose_name="单价")
    BookshelfName=models.CharField(max_length=50,verbose_name="书架名称")
    num=models.IntegerField(verbose_name="库存数量")
    class Meta:
        db_table="WantLook"
    def __str__(self):
        return self.name
class BookCateModel(models.Model):
    name=models.CharField(max_length=50,verbose_name="图书分类")
    class Meta:
        db_table="bookcate"
class NewBookModel(models.Model):
    is_Book=models.BooleanField(default=True,verbose_name="是否上架")
    class Meta:
        db_table="newbook"
    def __str__(self):
        return self.is_Book



